package com.fbinggun.dt.task.conditions;

import com.FBinggun.Qh.event.PlayerQhEvent;
import com.fbinggun.dt.task.Task;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

import java.sql.SQLException;

public class NewQh extends Conditions{
    String type;
    public NewQh(String id, ConfigurationSection config, Task task) {
        super(id, config, task);
        type=config.getString("Type");
    }
    @EventHandler
    public void qh(PlayerQhEvent event) throws SQLException, ClassNotFoundException {
        if(isRun(event.getPlayer())) {
            if(type!=null){
            if (event.getStatus().name().equalsIgnoreCase(type)) {
                addCount(event.getPlayer(), 1);
            }}else {
                addCount(event.getPlayer(), 1);
            }
        }
    }
}
